package com.xinqi.modules.discuss.notice.client;

import com.xinqi.common.base.constants.ServiceNameConstants;
import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.R;
import com.xinqi.modules.discuss.notice.dto.req.CourseNoticeCreateDTO;
import com.xinqi.modules.discuss.notice.dto.req.CourseNoticeQueryDTO;
import com.xinqi.modules.discuss.notice.dto.req.CourseNoticeUpdateDTO;
import com.xinqi.modules.discuss.notice.dto.rsp.CourseNoticeResultDTO;
import com.xinqi.modules.discuss.notice.factory.CourseNoticeFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 课程公告主表客户端
 *
 * @author: wenjie
 * @date: 2023/10/30
 */
@FeignClient(value = ServiceNameConstants.XQ_DISCUSS, fallbackFactory = CourseNoticeFallbackFactory.class)
public interface CourseNoticeClient {

    /**
     * 课程公告主表-分页
     */
    @GetMapping("/course-notice/page")
    R<PageInfo<CourseNoticeResultDTO>> page(CourseNoticeQueryDTO dto);

    /**
     * 课程公告主表-详情
     */
    @GetMapping("/course-notice/{id}")
    R<CourseNoticeResultDTO> findById(@PathVariable("id") Long id);

    /**
     * 新增课程公告主表
     */
    @PostMapping("/course-notice")
    R<Long> insert(@RequestBody CourseNoticeCreateDTO dto);

    /**
     * 修改课程公告主表
     */
    @PutMapping("/course-notice/{id}")
    public R<Boolean> update(@PathVariable("id") Long id, @RequestBody CourseNoticeUpdateDTO dto);

    /**
     * 删除课程公告主表
     */
    @DeleteMapping("/course-notice/{id}")
    R<Boolean> delete(@PathVariable("id") Long id);

    /**
     * 班级添加成员 -- 公告同步
     */
    @PostMapping("/course-notice/class-add-members")
    R<Boolean> classAddMembers(@RequestParam("classId") Long classId, @RequestParam("userId") Long userId);

    /**
     * 班级成员身份转换 -- 公告同步
     */
    @PostMapping("/course-notice/class-change-identity")
    R<Boolean> classChangeIdentity(@RequestParam("classId") Long classId, @RequestParam("userId") Long userId);

}
